package com.zhongxiangspace.service.impl;

import com.zhongxiangspace.entity.QueryAnalyzer;
import com.zhongxiangspace.entity.StationBranch;
import com.zhongxiangspace.entity.StationHouse;
import com.zhongxiangspace.entity.StationIcon;
import com.zhongxiangspace.mapper.StationBranchMapper;
import com.zhongxiangspace.service.StationBranchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 工位
 */
@Service
public class StationBranchServiceImpl implements StationBranchService {

    @Autowired
    private StationBranchMapper stationBranchMapper;

    /**
     * 工位图标icon
     *
     * @param type
     * @return
     */
    @Override
    public List<StationIcon> queryIcon(String type) {
        return this.stationBranchMapper.queryIcon(type);
    }

    /**
     * 插入数据
     *
     * @param stationBranch
     * @return
     */
    @Transactional
    @Override
    public boolean insert(StationBranch stationBranch) {
        return this.stationBranchMapper.insert(stationBranch);
    }

    /**
     * 根据条件获取data
     *
     * @param queryAnalyzer
     * @return
     */
    @Override
    public List<Map<String, Object>> queryAll(QueryAnalyzer queryAnalyzer) {
        return this.stationBranchMapper.queryAll(queryAnalyzer);
    }

    /**
     * 查询单条
     *
     * @param id
     * @return
     */
    @Override
    public StationBranch queryOne(Integer id) {
        return this.stationBranchMapper.queryOne(id);
    }

    /**
     * 更新data
     *
     * @param stationBranch
     * @return
     */
    @Override
    public boolean updata(StationBranch stationBranch) {
        return this.stationBranchMapper.updata(stationBranch);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Override
    public boolean delete(Integer id) {
        return this.stationBranchMapper.delete(id);
    }

    /**
     * 更新是否热门
     *
     * @param stationBranch
     * @return
     */
    @Override
    public boolean updataStateHot(StationBranch stationBranch) {
        return this.stationBranchMapper.updataStateHot(stationBranch);
    }

    /**
     * 上下线
     *
     * @param stationBranch
     * @return
     */
    @Override
    public boolean updataStates(StationBranch stationBranch) {
        return this.stationBranchMapper.updataStates(stationBranch);
    }

    /**
     * @param stationHouse
     * @return
     */
    @Override
    @Transactional
    public boolean attributeinsert(StationHouse stationHouse) {
        return this.stationBranchMapper.attributeinsert(stationHouse);
    }

    /**
     * 查询分部工位
     * @param station_id
     * @return
     */
    @Override
    public  List<StationHouse> queryStationHouse(Integer station_id) {
        return this.stationBranchMapper.queryStationHouse(station_id);
    }

    /**
     *  逻辑删除分部房源
     * @param id
     * @return
     */
    @Override
    public boolean deleteAttribute(Integer id) {
        return this.stationBranchMapper.deleteAttribute(id);
    }
}
